Skip to content

Fix WinRT JavaScript runtime-class interface input typing - #208

Merged
leileizhang (lei9444) merged 3 commits into
mainfrom
lei9444-fix-js-interface-input-typing
Oct 8, 2026
Merged

leileizhang (lei9444) merged 3 commits into
mainfrom
lei9444-fix-js-interface-input-typing

Conversation

@lei9444

@lei9444 leileizhang (lei9444) commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

StorageFile works with FileIO at runtime, but strict TypeScript rejects it as IStorageFile. StorageFolder has the same mismatch with IStorageFolder: classes merge overload names, while interfaces retain explicit aliases that the classes no longer expose.

Fix

Preserve metadata-projected instance aliases during overload merging and emit them as real JavaScript methods with matching declarations. Each alias keeps its declaring interface, QI, vtable slot and conversions. Existing class overloads, standalone interfaces and .as(...) views remain unchanged; existing public members take precedence on name collisions.

This adds interface-compatible class methods rather than widening inputs to any or declaring methods that do not exist at runtime. No native ABI, Python or release changes.

Verification

  • The original natural file/folder consumer now passes strict TypeScript and real temporary-file operations on ARM64 and x64. Unrelated Uri and wrong file/folder inputs remain rejected.
  • CJS/ESM tests cover independent/incremental generation, copy/move aliases and canonical overloads, AbortSignals and legacy interface views. Generator tests verify dispatch slots, QI and collision precedence.
  • Final-head Build, coverage and Python artifact checks passed.

Supporting CI-only changes format existing test-hook macros and compare canonical file identities on Windows runners; they do not change production dispatch.

leileizhang (lei9444) and others added 2 commits October 1, 2026 22:22
Keep existing class overload dispatchers while retaining metadata-projected interface aliases as real methods so StorageFile and StorageFolder satisfy their interface input types.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Accept optional trailing commas and format the two existing macro calls required by hosted Rust 1.99. Generated native signatures and behavior are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 86.93% 82.48% 86.65% regions
Python aggregate 72.34% n/a 39.42% branches
Python runtime 98.17% n/a 94.57% branches
Generated Python WinRT projections 71.07% n/a 33.5% branches
Generated Python WinRT implementations 71.97% n/a 46.3% branches
JavaScript aggregate 21.6% 24.93% 57.61% branches
JavaScript runtime 44.27% 45.76% 78.99% branches
Generated WinRT projections 22.64% 18.43% 54.84% branches
Generated WinRT implementations 45.99% 59.19% 60.97% branches
Generated Classic COM projections 11.52% 23.97% 53.4% branches

View workflow run and download full HTML/LCOV/XML reports

Compare real filesystem paths rather than hosted runner short-name spellings, and canonicalize the consumer root so strict TypeScript sees one path identity.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lei9444
leileizhang (lei9444) merged commit cae9db6 into main Oct 8, 2026
33 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-fix-js-interface-input-typing branch October 8, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants